package com.ruoyi.household.service.impl;

import java.util.List;

import com.ruoyi.floor.mapper.HsFloorMapper;
import com.ruoyi.household.domain.ro.RegisterRo;
import com.ruoyi.user.domain.HsUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.household.mapper.HsHouseholdMapper;
import com.ruoyi.household.domain.HsHousehold;
import com.ruoyi.household.service.IHsHouseholdService;

/**
 * 住户信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-07-25
 */
@Service
public class HsHouseholdServiceImpl implements IHsHouseholdService 
{
    @Autowired
    private HsHouseholdMapper hsHouseholdMapper;
    @Autowired
    private HsFloorMapper hsFloorMapper;

    /**
     * 查询住户信息
     * 
     * @param id 住户信息主键
     * @return 住户信息
     */
    @Override
    public HsHousehold selectHsHouseholdById(Long id)
    {
        return hsHouseholdMapper.selectHsHouseholdById(id);
    }

    /**
     * 查询住户信息列表
     * 
     * @param hsHousehold 住户信息
     * @return 住户信息
     */
    @Override
    public List<HsHousehold> selectHsHouseholdList(HsHousehold hsHousehold)
    {
        return hsHouseholdMapper.selectHsHouseholdList(hsHousehold);
    }

    /**
     * 新增住户信息
     * 
     * @param hsUser 住户信息
     * @return 结果
     */
    @Override
    public int insertHsHousehold(HsHousehold hsHousehold)
    {
      /*  RegisterRo registerRo = RegisterRo.registerRo(hsUser);
        registerRo.setFloorId(hsFloorMapper.getMaxId());*/
        return hsHouseholdMapper.insertHsHousehold(hsHousehold);
    }

    /**
     * 修改住户信息
     * 
     * @param hsHousehold 住户信息
     * @return 结果
     */
    @Override
    public int updateHsHousehold(HsHousehold hsHousehold)
    {
        return hsHouseholdMapper.updateHsHousehold(hsHousehold);
    }

    /**
     * 批量删除住户信息
     * 
     * @param ids 需要删除的住户信息主键
     * @return 结果
     */
    @Override
    public int deleteHsHouseholdByIds(Long[] ids)
    {
        return hsHouseholdMapper.deleteHsHouseholdByIds(ids);
    }

    /**
     * 删除住户信息信息
     * 
     * @param id 住户信息主键
     * @return 结果
     */
    @Override
    public int deleteHsHouseholdById(Long id)
    {
        return hsHouseholdMapper.deleteHsHouseholdById(id);
    }

    @Override
    public int insertHsHouseholdRegister(HsUser hsUser) {
       RegisterRo registerRo = RegisterRo.registerRo(hsUser);
        registerRo.setFloorId(hsFloorMapper.getMaxId());
        return hsHouseholdMapper.insertHsHouseholdRegister(registerRo);
    }
}
